home *** CD-ROM | disk | FTP | other *** search
-
- package sub_arctic.input;
-
- /**
- * Input protocol for objects that accept textual input. This protocol is
- * dispatched by the text focus agent. In addition to simple text input
- * this protocol provides features for filtering characters, recognizing
- * and acting of special "action characters", and performing standard
- * edit functions (i.e., character delete and line kill).
- *
- * @see sub_arctic.input.text_focus_agent
- * @author Scott Hudson
- */
- public interface text_acceptor extends focusable {
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * indicate that this object is the new text focus and will receive
- * subsequent text input.
- *
- * @param event evt the event that "caused" the start of text input.
- * @param Object user_info the user info associated with this object when it
- * was added to the focus set.
- * @returns boolean indicating if this input was consumed.
- */
- public boolean start_text_entry(event evt, Object user_info);
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Prefilter a character before providing it as input. This routine gets
- * called to allow the object to modify the character before it is passed
- * to new_char(). Input to the method is the ordinal value of the input
- * character in question along with the modifier mask associated with it.
- * Output should either be the ordinal value of a character or a specific
- * negative value signifying one of several special actions. This routine
- * can be used to do a translation (e.g. to all lower case) or to filter
- * out unwanted characters (e.g. everything except decimal digits). <p>
- *
- * Filtering is done by returning the special value DISCARD_CHAR (= -1),
- * which signifies that the character is not to be passed to new_char().
- * Translation is done by returning the ordinal value of the translated
- * character. In addition, the value CLOSURE_ACTION_CHAR (= -2) can be
- * returned to indicate that the action_char() method should be invoked
- * instead of new_char(). This is typically done for end of line
- * characters that signify completion of an entry.<p.
- *
- * All modifications to the character are considered local to this object
- * and do not change how the character might be delivered to another object.
- * This routine is not called for cursor movement or other special keys
- * (which are dispatched with special_key()), or characters classified as
- * edit keys (e.g. to delete a character or line). The text input dispatch
- * agent class (text_focus_agent) provides several standard filters that
- * can be called for common operations.
- *
- * @see sub_arctic.input.text_focus_agent
- * @see sub_arctic.input.event
- * @param int input_char ordinal value of the original input character.
- * @param int modifiers modifier mask (see event for encoding).
- * @return int the ordinal value of the translated character, or one of the
- * special (negative) values DISCARD_CHAR or CLOSURE_ACTION_CHAR.
- */
- public int char_filter(int input_char, int modifiers);
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Constant for return from char_filter signifying that character is to
- * be discarded.
- */
- public static final int DISCARD_CHAR = -1;
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Constant for return from char_filter to signify that character is to
- * be considered a closure point which ends input and should be acted upon
- * (usually this would be done for end of line characters).
- */
- public static final int CLOSURE_ACTION_CHAR = -2;
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Provide input for a single character.
- *
- * @param event evt the original event for the character input.
- * @param char ch the translated character that should be
- * considered the actual input.
- * @param Object user_info the user info that was associated with this object
- * when it was established as a text focus.
- */
- public boolean new_char(event evt, char ch, Object user_info);
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Provide input for a character that has been classified as a closure
- * action (by returning CLOSURE_ACTION_CHAR from char_filter).
- *
- * @param event evt the original event for the character input.
- * @param char ch the character.
- * @param Object user_info the user info that was associated with this object
- * when it was established as a text focus.
- */
- public boolean action_char(event evt, char ch, Object user_info);
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Provide input for a character signifying a delete. Returns true if the
- * object consumes the input. Currently, by default if either a backspace
- * or a delete character is seen, it will be treated as a delete character.
- * This behavior can be changed via the text input dispatch agent.
- * (Unfortunately, AWT does not currently provide a way to determine the
- * user's edit character preferences, so this is the best we can do.)
- *
- * @param event evt the event for the input.
- * @param Object user_info the user info that was associated with this object
- * when it was established as a text focus.
- */
- public boolean delete_char(event evt, Object user_info);
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /** Provide input for a character signifying a line kill. Returns true if
- * the object consumes the input. Currently a ^U ('\025') is treated as
- * a line kill. This behavior can be changed via the text input dispatch
- * agent. (Unfortunately, AWT does not currently provide a way to determine
- * the user's edit character preferences, so this is the best we can do.)
- *
- * @param event evt the event for the input.
- * @param Object user_info the user info that was associated with this object
- * when it was established as a text focus.
- */
- public boolean line_kill(event evt, Object user_info);
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /** Provide input for a key press signifying a special key (corresponding
- * to KEY_ACTION events). Values passed here are from the key field of the
- * events. These include: DOWN, END, F1, ..., F12, HOME, LEFT, PGDN, PGUP,
- * RIGHT, and UP. Returns true if the object consumes the event.
- *
- * @see sub_arctic.input.event
- * @param event evt the original event for the character input.
- * @param int key_code the key code for the action key (see event).
- * @param Object user_info the user info that was associated with this object
- * when it was established as a text focus.
- */
- public boolean special_key(event evt, int key_code, Object user_info);
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /** Provide input indicating that text input is over (e.g. the text focus
- * has moved elsewhere.
- *
- * @param event evt the event "causing" this input.
- * @param Object user_info the user info that was associated with this object
- * when it was established as a text focus.
- */
- public boolean end_text_entry(event evt, Object user_info);
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
- }
- /*=========================== COPYRIGHT NOTICE ===========================
-
- This file is part of the subArctic user interface toolkit.
-
- Copyright (c) 1996 Scott Hudson and Ian Smith
- All rights reserved.
-
- The subArctic system is freely available for most uses under the terms
- and conditions described in
- http://www.cc.gatech.edu/gvu/ui/sub_arctic/sub_arctic/doc/usage.html
- and appearing in full in the lib/interactor.java source file.
-
- The current release and additional information about this software can be
- found starting at: http://www.cc.gatech.edu/gvu/ui/sub_arctic/
-
- ========================================================================*/
-